//--------------------------------------- NOTES ------------------------------------------------------//
* This table is Table A10 in the paper 
//--------------------------------------------------------------------------------------------------------//

cd  "/YOUR_LOCAL_DIRECTORY" //setting the working directory
clear all //remove all data, labels, matrices etc (incl. Mata functions)
use game_state_pilot_data.dta, clear

* Create the key treatment variable
gen byte status_quo = treatment=="status_quo"
la var status_quo  "Status Quo"


* Create Y variable
****** How many balls are used?
gen ballsused = 0
replace ballsused = 1 if player2action=="MixWithLowBlue"
replace ballsused = 1 if player2action=="MixWithHighBlue"

****** Discard rate calculation
gen discardrate = 1-ballsused
replace discardrate =. if player1action!="Offer"

** Bad discard behavior
gen byte baddiscard = player1bluecount>player2lowbluecount & player1bluecount>player2highbluecount & player2action=="MixWithLowBlue" 
replace baddiscard =1 if player1bluecount>player2highbluecount & player1bluecount>player2lowbluecount & player2action=="MixWithHighBlue" 
replace baddiscard =1 if player1bluecount>player2lowbluecount & player1bluecount<player2highbluecount & player2action=="RejectOffer" 
replace baddiscard =1 if player1bluecount<player2lowbluecount & player1bluecount>player2highbluecount & player2action=="RejectOffer" 
replace baddiscard =. if player1action!="Offer" 

** Create bad discard rate
gen discard = 1-ballsused
gen baddiscard_rate = baddiscard/discard

* Make table (components)

* Make table (Pilot 1)

eststo clear

eststo: quietly reg player1bluecount status_quo if player1action=="Offer" & pilot==1,  vce(cluster room) // Compare average recovered jar quality by treatment group

eststo: quietly reg discardrate status_quo if pilot==1,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group
eststo: quietly reg discardrate status_quo player1bluecount if pilot==1,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group, controlling for jar quality
eststo: quietly reg discardrate status_quo player1bluecount player2highbluecount player2lowbluecount if pilot==1,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group, controlling for jar and urn qualities

eststo: quietly reg baddiscard_rate status_quo if pilot==1,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group
eststo: quietly reg baddiscard_rate status_quo player1bluecount if pilot==1,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group, controlling for jar quality
eststo: quietly reg baddiscard_rate status_quo player1bluecount player2highbluecount player2lowbluecount if pilot==1,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group, controlling for jar and urn qualities

esttab using table_discard_final_pilot1_a10.tex, se r2  keep(status_quo player1bluecount player2highbluecount player2lowbluecount _cons) star(+ 0.1 * 0.05 ** 0.01)

* Make table (Pilot 2)

eststo clear

eststo: quietly reg player1bluecount status_quo if player1action=="Offer" & pilot==2,  vce(cluster room) // Compare average recovered jar quality by treatment group

eststo: quietly reg discardrate status_quo if pilot==2,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group
eststo: quietly reg discardrate status_quo player1bluecount if pilot==2,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group, controlling for jar quality
eststo: quietly reg discardrate status_quo player1bluecount player2highbluecount player2lowbluecount if pilot==2,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group, controlling for jar and urn qualities

eststo: quietly reg baddiscard_rate status_quo if pilot==2,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group
eststo: quietly reg baddiscard_rate status_quo player1bluecount if pilot==2,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group, controlling for jar quality
eststo: quietly reg baddiscard_rate status_quo player1bluecount player2highbluecount player2lowbluecount if pilot==2,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group, controlling for jar and urn qualities

esttab using table_discard_final_pilot2_a10.tex, se r2  keep(status_quo player1bluecount player2highbluecount player2lowbluecount _cons) star(+ 0.1 * 0.05 ** 0.01)

* Make table (Pilot 3)

eststo clear

eststo: quietly reg player1bluecount status_quo if player1action=="Offer" & pilot==3,  vce(cluster room) // Compare average recovered jar quality by treatment group

eststo: quietly reg discardrate status_quo if pilot==3,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group
eststo: quietly reg discardrate status_quo player1bluecount if pilot==3,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group, controlling for jar quality
eststo: quietly reg discardrate status_quo player1bluecount player2highbluecount player2lowbluecount if pilot==3,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group, controlling for jar and urn qualities

eststo: quietly reg baddiscard_rate status_quo if pilot==3,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group
eststo: quietly reg baddiscard_rate status_quo player1bluecount if pilot==3,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group, controlling for jar quality
eststo: quietly reg baddiscard_rate status_quo player1bluecount player2highbluecount player2lowbluecount if pilot==3,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group, controlling for jar and urn qualities

esttab using table_discard_final_pilot3_a10.tex, se r2  keep(status_quo player1bluecount player2highbluecount player2lowbluecount _cons) star(+ 0.1 * 0.05 ** 0.01)

* Make table (Pilot 4)

eststo clear

eststo: quietly reg player1bluecount status_quo if player1action=="Offer" & pilot==4,  vce(cluster room) // Compare average recovered jar quality by treatment group

eststo: quietly reg discardrate status_quo if pilot==4,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group
eststo: quietly reg discardrate status_quo player1bluecount if pilot==4,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group, controlling for jar quality
eststo: quietly reg discardrate status_quo player1bluecount player2highbluecount player2lowbluecount if pilot==4,  vce(cluster room) // Compare kidney discard rate (jar acceptance rate) by treatment group, controlling for jar and urn qualities

eststo: quietly reg baddiscard_rate status_quo if pilot==4,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group
eststo: quietly reg baddiscard_rate status_quo player1bluecount if pilot==4,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group, controlling for jar quality
eststo: quietly reg baddiscard_rate status_quo player1bluecount player2highbluecount player2lowbluecount if pilot==4,  vce(cluster room) // Compare kidney BAD discard rate (jar acceptance rate) by treatment group, controlling for jar and urn qualities

esttab using table_discard_final_pilot4_a10.tex, se r2  keep(status_quo player1bluecount player2highbluecount player2lowbluecount _cons) star(+ 0.1 * 0.05 ** 0.01)
